<div class="box-wrapper-right-sidebar">
   	  <div class="box-title-right-sidebar">
        	Sự kiện sắp diễn ra
        </div>
        <!--box-content-right-sidebar-->
      	<div class="box-content-right-sidebar">
          <div class="item-box-right-sidebar">
		<?php
			 require_once ('class/SuKienDAO.php');
			 require_once('class/LikesDAO.php');
			 $dsSuKienSapDienRa = SuKienDAO::LayDanhSachSuKienSapDienRa();
			 $DSSuKien = "";
			 if (count($dsSuKienSapDienRa) == 0 || is_null($dsSuKienSapDienRa))
			 {
				  $DSSuKien ="<p>Không có sự kiện nào sắp diễn ra.<p>";
			 }
			 else
			 {
				  foreach($dsSuKienSapDienRa as $event)
				  {
					  	//format
					  	$ngayBD = date_create($event->NgayBatDau);
					  	$ngayBD = $ngayBD->format('d-m-Y');
					  	if (!file_exists($event->HinhAnh))
					 	{
							$event->HinhAnh = "image/event_default.png";
						}
										  
					  	$dsLikeSuKien = LikesDAO::LayDanhSachLikesTheoMaDoiTuong($event->MaSuKien);	
					  	$soNguoiLikeSK = count($dsLikeSuKien);
					  	$DSSuKien = $DSSuKien."
					  	<div class='title'>
							<a href='chi_tiet_su_kien.php?id=$event->MaSuKien&maGianHang=$event->MaGianHang'>$event->TenSuKien</a>
						</div>  				         
						<div class='content'>
						<div class='image'>
							<a href='#'><img src='$event->HinhAnh' width='80' height='80' /></a>
						  </div>
						  <div class='primary-content'>
							$event->NoiDungSuKien
						  </div>                    
						</div>
						<!--end .content itemboxrightsidebar-->
						<div class='info'>
							<div class='time'>$ngayBD</div>
							<div class='likes'>$soNguoiLikeSK</div>
						</div> 
						<!--end .info-->";
				 }
			}
		echo $DSSuKien;
		?>
				
          </div>
          <!--end .item-box-right-sidebar -->
          <div class="seperator-item-box-right-sidebar"></div>
          <!--end .seperator-item-box-right-sidebar-->
          
      	</div>
        <!--box-content-right-sidebar-->
        
       <div class="box-title-right-sidebar">
        	Sự kiện đang diễn ra
        </div>
        <!--box-content-right-sidebar-->
      	<div class="box-content-right-sidebar">
          <div class="item-box-right-sidebar">
		<?php
			 require_once ('class/SuKienDAO.php');
			 require_once('class/LikesDAO.php');
			 $dsSuKienDangDienRa = SuKienDAO::LayDanhSachSuKienDangDienRa();
			 $DSSuKien = "";
			 if (count($dsSuKienDangDienRa) == 0 || is_null($dsSuKienDangDienRa))
			 {
				  $DSSuKien ="<p>Không có sự kiện nào đang diễn ra.<p>";
			 }
			 else
			 {
				  foreach($dsSuKienDangDienRa as $event)
				  {
					  	//format
					 	$ngayBD = date_create($event->NgayBatDau);
					  	$ngayBD = $ngayBD->format('d-m-Y');
					  	if (!file_exists($event->HinhAnh))
					 	{
							$event->HinhAnh = "image/event_default.png";
						}
					  
					  	$dsLikeSuKien = LikesDAO::LayDanhSachLikesTheoMaDoiTuong($event->MaSuKien);	
					  	$soNguoiLikeSK = count($dsLikeSuKien);
					 	$DSSuKien = $DSSuKien."
					  	<div class='title'>
							<a href='chi_tiet_su_kien.php?id=$event->MaSuKien&maGianHang=$event->MaGianHang'>$event->TenSuKien</a>
						</div>  				         
						<div class='content'>
						<div class='image'>
							<a href='#'><img src='$event->HinhAnh' width='80' height='80' /></a>
						  </div>
						  <div class='primary-content'>
							$event->NoiDungSuKien
						  </div>                    
						</div>
						<!--end .content itemboxrightsidebar-->
						<div class='info'>
							<div class='time'>$ngayBD</div>
							<div class='likes'>$soNguoiLikeSK</div>
						</div> 
						<!--end .info--> ";
				}
			}
			echo $DSSuKien;
		?>
				
          </div>
          <!--end .item-box-right-sidebar -->
          <div class="seperator-item-box-right-sidebar"></div>
          <!--end .seperator-item-box-right-sidebar-->
          
      	</div>
        <!--box-content-right-sidebar-->
   	  </div>